﻿@model Opds4Net.Web.Models.Book

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<!-- enctype = "multipart/form-data" 用于 上传文件 -->
@using (Html.BeginForm("Create", "Book", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Book</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Author)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Author)
            @Html.ValidationMessageFor(model => model.Author)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Publisher)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Publisher)
            @Html.ValidationMessageFor(model => model.Publisher)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IssueTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IssueTime)
            @Html.ValidationMessageFor(model => model.IssueTime)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.OriginalPrice)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.OriginalPrice)
            @Html.ValidationMessageFor(model => model.OriginalPrice)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.SalePrice)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SalePrice)
            @Html.ValidationMessageFor(model => model.SalePrice)
        </div>

        <div class="editor-label">
            File:
        </div>
        <div class="editor-field">
            <input name="file" type="file" />
        </div>

        @Html.HiddenForWithValue(model => model.MimeType, "application", new Dictionary<string, object>() { { "data-val", false } })

        @Html.Partial("_CategorySelector", Model)

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
